
# -*- coding: utf-8 -*-
#  主从表配制面板
# @Time    ： 2024/4/12  10:51
# @Auther  ： 徐良
# File     :  msTableSetPanel.py

from PySide6.QtCore import Qt, Slot
from baseClass.baseQWidget import BaseQWidget
from baseModule.ui.msTableSetUI import Ui_Form
import share.globalvar as gol
from share.dataFactory import DataFactory


class MsTableSetPanel(BaseQWidget, Ui_Form):
    """
    主从表配制面板
    """
    def __init__(self, msDict, parent=None):
        super(MsTableSetPanel, self).__init__()
        self.queryPanel = None
        self.setAttribute(Qt.WA_StyledBackground, True)
        self.setupUi(self)
        self.toolbarFlag = 'browse'
        self.stackedW = "Yes"
        self.baseDbType = gol.getValue('baseDbType')
        # print(self.baseDbType)
        print(msDict)

        self.readMainTable()
        self.readHeadTable()
        self.readBodyTable()

        self.changeLabels()

    def changeLabels(self):
        """
        设置面板提示
        :return:
        """
        self.lbl_parent.setText('主从表配制表数据')
        self.lbl_head.setText('表头配制表数据')
        self.lbl_body.setText('表体配制表数据')


    def readMainTable(self):
        """
        读取主表数据
        :return:
        """
        pass

    def readHeadTable(self):
        """

        :return:
        """
        pass

    def readBodyTable(self):
        """

        :return:
        """
        pass



    def actionSelect(self, q):
        sel = q.text()


    def save(self):
        """
        保存单据
        """
        pass

    @Slot()
    def on_btn_addHead_clicked(self):
        """
        编辑格式增加
        :return:
        """
        print('表头')

    @Slot()
    def on_btn_insertHead_clicked(self):
        """
        编辑格式插入
        :return:
        """
        print('表头 insert')

    @Slot()
    def on_btn_delHead_clicked(self):
        """
        表格格式增加
        :return:
        """
        print('表头 del')

    @Slot()
    def on_btn_addBody_clicked(self):
        """
        表格格式插入
        :return:
        """

        print('表体 add')

    @Slot()
    def on_btn_insertBody_clicked(self):
        print('表体 insert')

    @Slot()
    def on_btn_delBody_clicked(self):
        """
        表格格式删除
        :return:
        """
        print('表体 del')


if __name__ == '__main__':
    import sys
    from PySide6.QtWidgets import QApplication
    app = QApplication(sys.argv)
    dic = "{'msFNumber': '70.05', 'msClass': '11', 'msSaveType':1}"
    window = MsTableSetPanel(dic)
    window.show()
    sys.exit(app.exec())



